<template>
    <div>
        <h3>当前最新的count值为:{{this.$store.state.count}} </h3>
        <button @click="btnHandle1">+1</button>
        <button @click="btnHandle2">+n</button>
        <button @click="btnHandle3">+1 async</button>
        <button @click="btnHandle4">+n async</button>
    </div>
</template>
<script>
export default {
    data(){
        return{

        }
    },
    methods:{
        btnHandle1(){
            this.$store.commit('add')
        },
        btnHandle2(){
            //commit 作用是 调用某个mutations  函数
            this.$store.commit('addN',3)
        },
        btnHandle3(){
            //通过 dispatch 专门触发 action 某个 函数
            this.$store.dispatch('addAsync')
        },
        btnHandle4(){
            this.$store.dispatch('addNAsync',5)
        }
    }
}
</script>
<style lang="less" scoped>

</style>